<template>

  <a-tree-select
          v-model="value"
          show-search
          style="width: 200px; height: 40px;"
          :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
          placeholder="Please select"
          @change="argumentSelect"
          tree-default-expand-all
        >
      
          <a-tree-select-node
            v-for="item in departmentList"
            :key="item.id"
            :cont="item"
            :value="item.custorgname"
            :title="item.custorgname"
          >
            <a-tree-select-node
              v-for="int in item.children"
              :key="int.id"
              :cont="int"
              :value="int.custorgname"
              :title="int.custorgname"
            >
              <a-tree-select-node
                v-for="ins in int.children"
                :key="ins.id"
                :cont="ins"
                :value="ins.custorgname"
                :title="ins.custorgname"
              />
            </a-tree-select-node>
          </a-tree-select-node>
        </a-tree-select>
</template>

<script >
import {getPerages} from '@/api/keraStase'
export default {
  name: "SelectTree",
  props: {
    treeDataList: [],
    defaultVaule:''
  },
  data(){
      return {
          // defalutTree: '',
          departmentList:[],
          defaultSelect:'',
          value:''
      }
  },
  created(){
    getPerages({params:{orgType:1}})
    .then(res => {
      this.departmentList = res.data
      this.value = res.data[0].custorgname
    })

  },
 
  methods: {
      argumentSelect(value, key, extra) {
          this.$emit("checkData",extra.triggerNode.$attrs.cont)
      }
  }
};
</script>
<style scoped lang="scss">
.select-tree {
    width: 200px;
}
</style>